index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation1></HomePageNavigation1>
  6. <!-- 列表页广告一 -->
  7. <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
  8. <!-- 面包屑导航 -->
  9. <div class="breadcrumb">
  10. <div class="inner">
  11. <span class="location">当前位置:</span>
  12. <el-breadcrumb :separator-icon="ArrowRight">
  13. <el-breadcrumb-item>
  14. <NuxtLink to="/">首页</NuxtLink>
  15. </el-breadcrumb-item>
  16. <el-breadcrumb-item>
  17. {{ newsDetail.con_title }}
  18. </el-breadcrumb-item>
  19. </el-breadcrumb>
  20. </div>
  21. </div>
  22. <!-- 资讯列表 -->
  23. <div class="newsDetail">
  24. <div class="inner">
  25. <div class="innerLeft">
  26. <div class="leftBottomTitle">{{ newsDetail.con_title }}</div>
  27. <div class="leftBottom" v-html="newsDetail.content" v-if="newsDetail.content"></div>
  28. </div>
  29. <div class="innerRight">
  30. <div class="rightMenuTitle">导航列表</div>
  31. <ul>
  32. <li v-for="(item, index) in bottomMenu" :key="index">
  33. <NuxtLink :to="`/about/${item.name_pinyin}/`" :title="item.name"
  34. v-if="item.id == pageId && item.id != 7" class="active">
  35. {{ item.name }}
  36. </NuxtLink>
  37. <NuxtLink :to="`/about/${item.name_pinyin}/`" :title="item.name"
  38. v-else-if="item.id != pageId && item.id != 7">
  39. {{ item.name }}
  40. </NuxtLink>
  41. <NuxtLink :to="`/about/${item.name_pinyin}/1.html`" :title="item.name"
  42. v-if="item.id == 7 && pageId == 7 && routeHref == '/specialList/7'" class="active">
  43. {{item.name }}
  44. </NuxtLink>
  45. <NuxtLink :to="`/about/${item.name_pinyin}/1.html`" :title="item.name" v-else-if="item.id == 7">
  46. {{ item.name}}
  47. </NuxtLink>
  48. </li>
  49. </ul>
  50. </div>
  51. <div style="clear: both;"></div>
  52. </div>
  53. </div>
  54. <!-- 广告二 -->
  55. <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
  56. <!-- 页面底部 -->
  57. <HomeFoot1></HomeFoot1>
  58. </template>
  59. <script setup>
  60. //1.页面依赖 start ---------------------------------------->
  61. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  62. import { ArrowRight } from '@element-plus/icons-vue'
  63. import { ref, onMounted } from 'vue';
  64. //获得跳转过来的id
  65. const route = useRoute();
  66. //获得当前的完整路径
  67. const fullPath = route.path;
  68. //拆分,取出来中间这一段,然后提取数字部分
  69. const segments = fullPath.split('/');
  70. const targetSegment = segments[2];
  71. const numberPart = targetSegment.match(/\d+$/)?.[0];
  72. //路由id
  73. //let routeId = 11 //排除路径错误可以打开这个
  74. let articleId = numberPart;
  75. const pageId = numberPart;//左侧菜单选中哪个
  76. // const routeHref = route.href;
  77. //1.页面依赖 end ---------------------------------------->
  78. //2.页面数据 start ---------------------------------------->
  79. //广告列表
  80. const adList = ref([]);
  81. let adImg1 = ref([]);
  82. let adImg2 = ref([]);
  83. async function getAdData(){
  84. const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'PAGE'}});
  85. adList.value = adData.data;
  86. if(adData.code==200){
  87. for(let item of adData.data){
  88. if(item.ad_tag == 'PAGE_0001'){
  89. adImg1.value = item;
  90. }
  91. if(item.ad_tag == 'PAGE_0002'){
  92. adImg2.value = item;
  93. }
  94. }
  95. }else{
  96. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  97. console.log("错误位置:获取详情页广告列表")
  98. console.log("后端错误反馈:",adData.message)
  99. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  100. }
  101. }
  102. getAdData();
  103. const newsDetail = ref({})
  104. const bottomMenu = ref([]);
  105. async function getPageData() {
  106. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  107. method: 'GET',
  108. query: {
  109. 'fcat_id': articleId
  110. },
  111. });
  112. newsDetail.value = mkdata.data;
  113. }
  114. getPageData();
  115. async function getPageMenu() {
  116. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  117. method: 'GET',
  118. query: {},
  119. });
  120. bottomMenu.value = mkdata.data;
  121. }
  122. getPageMenu();
  123. //2.页面数据 end ---------------------------------------->
  124. //4.设置seo信息 start---------------------------------------->
  125. //4.1 设置seo信息
  126. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  127. method: 'GET',
  128. query: {},
  129. });
  130. let seoTitle = setData.data.website_head.title;
  131. let seoDescription = setData.data.website_head.description;
  132. let seoKeywords = setData.data.website_head.keywords;
  133. let seoSuffix = setData.data.website_head.suffix;
  134. let seoName = setData.data.website_head.website_name;
  135. useSeoMeta({
  136. title: seoTitle + "_" + seoSuffix,
  137. meta: [
  138. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  139. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix , tagPriority: 10 }
  140. ]
  141. });
  142. //4.设置seo信息 end---------------------------------------->
  143. onMounted(async () => {
  144. //从客户端获取行政职能部门 加快打开速度
  145. const { $webUrl, $CwebUrl } = useNuxtApp();
  146. //广告1
  147. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_page_0001`
  148. const responseAd1 = await fetch(url, {
  149. headers: {
  150. 'Content-Type': 'application/json',
  151. 'Userurl': $CwebUrl,
  152. 'Origin': $CwebUrl
  153. }
  154. });
  155. const resultAd1 = await responseAd1.json();
  156. adImg1.value = resultAd1.data[0];
  157. //广告2
  158. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_page_0002`
  159. const responseAd2 = await fetch(url2, {
  160. headers: {
  161. 'Content-Type': 'application/json',
  162. 'Userurl': $CwebUrl,
  163. 'Origin': $CwebUrl
  164. }
  165. });
  166. const resultAd2 = await responseAd2.json();
  167. adImg2.value = resultAd2.data[0];
  168. })
  169. </script>
  170. <style lang="less" scoped>
  171. //导航条
  172. .breadcrumb {
  173. width: 100%;
  174. height: 22px;
  175. margin-bottom: 30px;
  176. font-family: Microsoft YaHei, Microsoft YaHei;
  177. font-weight: 400;
  178. font-size: 20px;
  179. color: #666666;
  180. line-height: 23px;
  181. text-align: left;
  182. font-style: normal;
  183. text-transform: none;
  184. .el-breadcrumb::v-deep {
  185. display: inline-block;
  186. vertical-align: -4px;
  187. }
  188. /deep/.el-breadcrumb__inner a,
  189. /deep/.el-breadcrumb__inner.is-link {
  190. color: #666666;
  191. font-weight: 400;
  192. text-decoration: none;
  193. transition: var(--el-transition-color);
  194. }
  195. span {
  196. font-family: Microsoft YaHei, Microsoft YaHei;
  197. font-weight: 400;
  198. font-size: 20px;
  199. color: #666666;
  200. line-height: 23px;
  201. text-align: left;
  202. font-style: normal;
  203. text-transform: none;
  204. }
  205. span:hover {
  206. color: #666666;
  207. }
  208. .location {
  209. margin-right: 20px;
  210. width: 100px;
  211. height: 22px;
  212. font-family: Microsoft YaHei, Microsoft YaHei;
  213. font-weight: 400;
  214. font-size: 20px;
  215. color: #666666;
  216. line-height: 23px;
  217. text-align: left;
  218. font-style: normal;
  219. text-transform: none;
  220. }
  221. }
  222. // 资讯列表
  223. .newsDetail {
  224. width: 100%;
  225. //height: 1400px;
  226. margin-bottom: 70px;
  227. .inner {
  228. width: 1200px;
  229. //height: 1400px;
  230. font-size: 16px;
  231. .innerLeft {
  232. //height: 1400px;
  233. float: right;
  234. .LeftTop {
  235. //height: 522px;
  236. margin-top: 50px;
  237. >h1 {
  238. line-height: 40px;
  239. margin-bottom: 30px;
  240. font-family: Microsoft YaHei, Microsoft YaHei;
  241. font-weight: bold;
  242. font-size: 30px;
  243. color: #333333;
  244. }
  245. >p {
  246. height: 18px;
  247. line-height: 18px;
  248. font-family: Microsoft YaHei, Microsoft YaHei;
  249. font-weight: 400;
  250. font-size: 14px;
  251. color: #999999;
  252. span {
  253. margin-right: 40px;
  254. }
  255. }
  256. >img {
  257. width: 680px;
  258. height: 382px;
  259. padding: 50px 0px 60px 55px;
  260. }
  261. }
  262. .leftBottomTitle {
  263. color: #028E21;
  264. font-size: 24px;
  265. font-weight: bold;
  266. height: 60px;
  267. line-height: 60px;
  268. }
  269. .leftBottom {
  270. width: 790px;
  271. font-size: 20px;
  272. border-top: 1px solid #139602;
  273. padding-top: 40px;
  274. >h3,
  275. >p {
  276. text-indent: 2em;
  277. width: 790px;
  278. font-family: Microsoft YaHei, Microsoft YaHei;
  279. font-size: 20px;
  280. color: #333333;
  281. line-height: 23px;
  282. padding-bottom: 30px;
  283. }
  284. >h3 {
  285. font-weight: 600px;
  286. }
  287. >p {
  288. font-weight: 400;
  289. }
  290. }
  291. }
  292. .innerRight {
  293. width: 279px;
  294. .rightMenuTitle {
  295. width: 279px;
  296. height: 69px;
  297. font-size: 22px;
  298. font-weight: bold;
  299. line-height: 58px;
  300. text-align: center;
  301. color: #fff;
  302. background: url("http://img.bjzxtw.org.cn/master/bjzxtw/public/special/projectMoreTitle.png") no-repeat;
  303. margin-bottom: 30px;
  304. }
  305. ul {
  306. li {
  307. a {
  308. border-left: 5px solid #028E21;
  309. margin-bottom: 15px;
  310. font-size: 22px;
  311. display: block;
  312. height: 61px;
  313. line-height: 61px;
  314. color: #333333;
  315. text-align: center;
  316. background: #FBFBFB;
  317. }
  318. }
  319. }
  320. .active {
  321. border-left: 0;
  322. border: 1px solid #028E21;
  323. background: #fff;
  324. }
  325. }
  326. }
  327. }
  328. </style>